﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wap/Shop/ShopSite.Master" AutoEventWireup="true"
    CodeBehind="AddressDetail.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.AddressDetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>地址详情</title>
    <link href="/Wap/lib/validator-0.7.0/css/jquery.validator.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    .msg-box{float:right;margin-top: -20px;}
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="pages" runat="server">

<!--S page -->
<div data-role="page" id="mypage">

	<!--S header -->
	<div data-role="header">
    	
	</div>
    <!--E header -->
	
    <!--S content -->
	<div role="main" class="ui-content">
    <!--s add_address-->
    <div class="add_address">
        <form method="post" id="formId" command='Member.SaveAddress'>
        <input command-param='AddressId' type="hidden" value='<%=string.IsNullOrEmpty(Request["addressid"]) ?"0":Request["addressid"] %>' />
        <input command-param='MemberAccount' type="hidden" value='<%=CurrentMemberAccount %>' />
  
        <ul>
            <li>收货人</li>
            <li>
                <input type="text" command-param='Receiver' placeholder="收货人" data-rule="required;accept" name="Receiver"
                    prop="Data.Receiver">
            </li>
        </ul>
        <ul>
            <li>手机号码</li>
            <li>
                <input type="text" placeholder="请输入联系电话" command-param='Phone' name="Phone"
                    prop="Data.Phone" data-rule="required;mobile">
            </li>
        </ul>
        <ul>
            <li>省份</li>
            <li>
                <select name="Province" command-param='Province' class="area" data-theme="e" Category="Province" ReferenceCategory="City"
                    data-rule="selectval">
                    <option value="-1">请选择</option>
                </select>
            </li>
        </ul>
      <ul>
            <li>市</li>
            <li>
                <select name="City" data-theme="e" command-param='City' class="area" Category="City" ReferenceCategory="Area"
                    data-rule="selectval">
                    <option value="-1">请选择</option>
                </select>
            </li>
        </ul>
        <ul>
            <li>区/县</li>
            <li>
                <select name="Area" data-theme="e" command-param='Area' class="area" Category="Area" >
                    <option value="-1">请选择</option>
                </select>
            </li>
        </ul> <%-- --%>
        <ul>
            <li>详细地址</li>
            <li>
                <textarea cols="40" rows="8" command-param='Address' name="Address"
                    data-rule="required" placeholder="请输入详细的地址" prop="Data.Address"></textarea>
            </li>
        </ul>
        <ul>
            <li>
                <label>
                    <input type="checkbox" name="ckmr" onchange="$('#addr_status').val((($(this).prop('checked')==true)?'1':'0'))">
                    <input prop="Data.Status" type="hidden" id="addr_status" command-param='Status'>
                </label>
            </li>
            <li>
                <label for="ckmr">
                    设为默认地址</label></li>
        </ul>
   <%--     <div class="btn">
            <a onclick="executeFormCommonCommand('formId', applyDone)" data-role="button" data-theme="j">
                确认</a></div>--%>
        </form>
        
            <div class="onlybutton"><a href="#" onclick="executeFormCommonCommand('formId', saveOk)" data-role="button" data-theme="o" data-shadow="false" >确认</a></div>
    </div>
    <!--e add_address-->

    
 	</div>
    <!--E content -->
	
    <!--S footer -->
	<div data-role="footer" data-position="fixed" data-tap-toggle="false">
    </div>
    <!--E footer -->
</div>
<!--E page -->
<script src="/Wap/lib/validator-0.7.0/jquery.validator.js?v=1" type="text/javascript"></script>
<script src="/Wap/lib/validator-0.7.0/local/zh_CN.js?v=1" type="text/javascript"></script>
<script src="/wap/lib/common/loaderHandler.js" type="text/javascript"></script>
<script src="/wap/lib/common/addressCascade.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        var addressId = '<%=string.IsNullOrEmpty(Request["addressid"]) ?"0":Request["addressid"] %>';

        var handler = $('#formId').loaderHandler();
        handler.initialize({
            command: 'Member.LoadAddressDetail',
            parameter: { AddressId: '<%=string.IsNullOrEmpty(Request["addressid"]) ?"0":Request["addressid"] %>', MemberAccount: '<%=CurrentMemberAccount %>' },
            beforeHandleResult: function (result, totalCount, container) {
                $('select[Category]').addressCascade();
                if (result && result.Data) {
                    $('select[Category=Province]').attr('default_val', result.Data.ProvinceCode);
                    $('select[Category=City]').attr('default_val', result.Data.CityCode);
                    $('select[Category=Area]').attr('default_val', result.Data.AreaCode);
                }
            },
            afterHandleResult: function (result, totalCount, container) {
                $('input[name=ckmr]').prop('checked', $('#addr_status').val() == '1').checkboxradio("refresh");
            }
        });
        handler.load();

    });

    $('input[prop]').bind('valuechange', function (event, param) {
        $(this).val(param.value);
        $(event.target).triggerHandler('valuechanged', param);
        return false;
    });

    function saveOk() {
        showTips('保存成功', 500, function () { location.href = "AddressList.aspx"; });
    }

</script>
</asp:Content>
